#pragma 
#define _CRT_SECURE_NO_WARNINGS

#include <mysql.h>
#include <string>
#include <iostream>
#include <sstream>
#include <cstddef> 
#include <vector>
#include <ctime>
#include <iomanip>

using namespace std;

//Mysql用户类
class MysqlUser {
public:
    MYSQL* conn;

    MysqlUser(const char* Host, const char* Name, const char* Password, const char* DbName, unsigned int port, const char* Socket, unsigned long clientflag);
    ~MysqlUser();

    bool connect();
    void disconnect();
    bool setCharSet(const char* charset);

    bool startTransaction();
    bool commitTransaction();
    bool rollbackTransaction();

    bool executeQuery(const std::string& query);
    bool insert(const std::string& query);
    bool remove(const std::string& query);
    bool update(const std::string& query);
    vector<vector<std::string>>select(const std::string& query);
    bool TransactionExecuteQuery(const string& query);

private:
    const char* Host;
    const char* Name;
    const char* Password;
    const char* DbName;
    unsigned int port;
    const char* Socket;
    unsigned long clientflag;
};


// 额外功能函数
long long TurnTimeStyle(string timeStr);
string ParseTimeStyle(long long unixTime);